# MakeBy: LiuBoyuan
from dataclasses import dataclass, field, asdict
from typing import List


@dataclass
class Point:
    x: int
    y: int
    power: str = field(default=None)

    # WARN 以下属性生效规则是 power 不为: None
    city: str = field(default_factory=list)
    army: List[str] = field(default_factory=list)
    map_config: dict = field(default_factory=dict)

    def map_name(self):
        return (self.x - 1) * 30 + self.y

    def to_json(self):
        return asdict(self)


fake_json = {
    "青兰": {
        'city': [["青兰主城", [7, 14]]],
        'army': [["卷零", "洛斯"], [7, 12]],
        'block': [[1, 1], [1, 4]]
    },
    "龙城": {
        'city': [["龙城主城", [17, 12]]],
        'army': [["霜冰语", "冰泉涛"], [7, 18]],
        'block': [[7, 5], [30, 7]]
    }
}

if __name__ == '__main__':
    print()
